package main

import "fmt"

//万能类型
//空接口 interface{}
func myFunc(arg interface{}) {
	fmt.Println("myFunc is call...")
	fmt.Println(arg)

	//给 interface{} 提供 "类型断言"机制
	val, ok := arg.(string)
	if !ok {
		fmt.Println("arg is not string type")
	} else {
		fmt.Println("arg is string type, val=", val)
		fmt.Printf("val type is %T\n", val)
	}
}

type Book struct {
	auth string
}

func main() {

	book := Book{"Golang"}
	myFunc(book)
	myFunc(100)
	myFunc("abc")
}
